<%-- 
    Document   : Creat
    Created on : Jun 11, 2013, 8:53:15 PM
    Author     : Huong
--%>

<%@page import="java.util.Date"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>

    <body>
        <jsp:useBean id = "project" class="myBean.Project"/>

        <h1>
            Project Management
        </h1>
        <h2>
            Create project
        </h2>
        <form method="POST">

            <table>
                <tr>
                    <td>
                        Project code
                    </td>
                    <td>
                        <input type="text" name="P_Code" value="" />
                    </td>
                </tr>
                <tr>
                    <td>
                        Project name
                    </td>
                    <td>
                        <input type="text" name="P_Name" value="" />
                    </td>
                </tr>
                <tr>
                    <td>
                        Status
                    </td>
                    <td>
                        <input type="radio" name="Active" value="Active" checked="checked" /> Active
                        <input type="radio" name="Active" value="Inactive" /> Inactive
                    </td>
                </tr>
                <tr>
                    <td>
                        Start date
                    </td>
                    <td>
                        <input type="text" name="S_Date" value="" />
                    </td>
                </tr>
                <tr>
                    <td>
                        End Date
                    </td>
                    <td>
                        <input type="text" name="E_Date" value="" />
                    </td>
                </tr>
                <tr>
                    <td>
                        Employee
                    </td>
                    <td>
                        <input type="text" name="Emp" value="" />
                    </td>
                </tr>
                <tr>
                    <td>
                    <td>
                        <input type="submit" value="Create" />
                    </td>
                </tr>
            </table>
        </form>

        <%
            String pcode = request.getParameter("P_Code");
            String pname = request.getParameter("P_Name");
            String status = request.getParameter("Active");
            int emp = Integer.parseInt(request.getParameter("Emp"));
            String sDate = request.getParameter("S_Date");
            String eDate = request.getParameter("E_Date");
            
            if(pcode != null){
                project.creat(pcode, pname, status, sDate, eDate, emp);
                 RequestDispatcher dispatcher = request.getRequestDispatcher("/project.jsp");
            dispatcher.forward(request, response);
            }
        %>
    </body>
</html>
